package com.weiyuanstudio.nextstep.controller;

import com.weiyuanstudio.nextstep.persistence.entity.User;
import com.weiyuanstudio.nextstep.persistence.repository.UserRepository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/user")
public class UserController {
    private final UserRepository userRepository;
    public UserController(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    @GetMapping("/user-info")
    public List<User> allUser() {
        return userRepository.findAll();
    }
}
